function val = bbs_eval(bbs, ctrlpts, u, v, du, dv)
%bbs_eval Evaluate a B-Spline (or its derivatives).
%
% val = bbs_eval(bbs, ctrlpts, u, v)
% val = bbs_eval(bbs, ctrlpts, u, v, du, dv)
%
% Evaluate a bidimensional B-Spline at the locations (u,v).
%
% INPUT ARGUMENTS
%
%   bbs: B-Spline structure (as created by bbs_create).
%
%   ctrlpts [(valdim x nptsu*nptsv) matrix]: control points of the B-Spline.
%
%   u, v [matrices]: Location where the B-Spline must be evaluated.
%
%   du, dv [optional, scalars]: Order of derivation along the u and v
%   directions respectively. Note that "bbs_eval(bbs, ctrlpts, u, v, 0, 0)" is
%   equivalent to "bbs_eval(bbs, ctrlpts, u, v)".
%
% OUTPUT ARGUMENTS
%
%   val [(valdim x numel(u)) matrix]: evaluation of the b-spline.
%   Note that u and v can be of any shape but that val is always of the
%   above-mentioned shape. Linear indexing is used to access u and v.
%   "val(:,i)" corresponds to (u(i),v(i)).
%
% (c)2009-2010, Florent Brunet.

% BBS is free software; you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation; either version 3 of the License, or
% (at your option) any later version.
% 
% BBS is distributed in the hope that it will be useful, but
% WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
% or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
% for more details.
% 
% You should have received a copy of the GNU General Public License along
% with this program; if not, write to the Free Software Foundation, Inc.,
% 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
